﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMatrix.WebData;
using Microsoft.Web.WebPages.OAuth;
using QuakerSchool.Filters;
using QuakerSchool.Models;

namespace QuakerSchool.Controllers
{
    [Authorize]
    [InitializeSimpleMembership]
    public class DashboardController : Controller
    {
        public ActionResult Index()
        {
            bool hasLocalAccount = OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(User.Identity.Name));
            ViewBag.HasLocalPassword = hasLocalAccount;
            ViewBag.ReturnUrl = Url.Action("Index");
            if (hasLocalAccount)
            {
                ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
                ViewData.Add("CurrentPage", "Index");
            }
            else
            {
                AccountController ac = new AccountController();
                ac.Login(ViewBag.ReturnUrl);
            }
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";
            ViewData.Add("CurrentPage", "About");

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
